﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PJ.Framework
{
    /// <summary>
    /// Object cache interface
    /// </summary>
    public interface IObjectCache
    {
        /// <summary>
        /// Finds the cached object instance
        /// </summary>
        /// <param name="key">cache key</param>
        /// <returns><see langref="object"/> if found else <see langref="null"/>.</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="key"/> is <see langref="null"/> or empty.</exception>
        object Find(string key);

        /// <summary>
        /// Adds an object instance to the cache
        /// </summary>
        /// <param name="key">cache key</param>
        /// <param name="instance"><see langref="object"/> instance</param>
        /// <exception cref="ArgumentNullException">If <paramref name="key"/> is <see langref="null"/> or empty.</exception>
        /// <exception cref="ArgumentNullException">If <paramref name="instance"/> is <see langref="null"/>.</exception>
        void Add(string key, object instance);
    }
}
